package com.liu.web.controller;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.liu.model.User;

@RestController //声明rest风格的控制器
//@EnableAutoConfiguration    //自动配置，相当于写了spring的配置
@RequestMapping("user")
public class UserController {

    @RequestMapping("{id}")
    @ResponseBody   //把返回的String转为json
    /**
     * 通过id查找用户信息
     */
    public User userInfo(@PathVariable() Integer id){
        User user = new User("gyf","123");
        user.setId(id);
        int i = 10/0;
        return user;
    }

//    public static void main(String[] args) {
//        //启动springboot项目
//        SpringApplication.run(UserController.class,args);
//    }

}
